import request from "@/utils/request";
import type {ResponseGetPermission,getPermission} from './type'
enum API{
    //获取权限接口请求地址
    GETPERMISSION_URL='/api/admin/acl/Permission/getPermission',
    //添加权限接口请求地址
    ADDPERMISSION_URL='/api/admin/acl/Role/createPermission',
    //修改权限接口请求地址
    UPDATEPERMISSION_URL='/api/admin/acl/Permission/updatePermisson',
    //删除权限请求地址
    DELETEPERMISSION_URL='/api/admin/acl/Permission/deletePermission/'

}
//获取权限请求方法
export const reqGetPermission=()=>request.get<any,ResponseGetPermission>(API.GETPERMISSION_URL)
//添加|修改权限请求方法
export const reqAddOrUpdatePermission=(ParamasPermission:getPermission)=>{
    if(ParamasPermission.id){
        //修改
        return request.post<any,any>(API.UPDATEPERMISSION_URL,ParamasPermission)
    }else{
        //新增
        return request.post<any,any>(API.ADDPERMISSION_URL,ParamasPermission)
    }
}
//删除权限请求地址
export const reqDeletePermission=(id:number|string)=>request.delete<any,ResponseGetPermission>(API.DELETEPERMISSION_URL+`${id}`)
